<h2><?= $this->escape($this->element->getAttrib('title')) ?></h2>
<p class="description"><?= $this->escape($this->element->getAttrib('description')) ?></p>

<?php
	$value = $this->element->getValue();
	$userinput = $value['userinput'];
	$value = $value['value'];
?>

<ol>
	<?php foreach($this->element->getAttrib('options') as $weight=>$text) { ?>
	<li><input type="radio" value="<?= $weight ?>" name="<?= $this->element->getName() ?>[value]" id="<?= $this->element->getName()."_".$weight ?>" <?= $value === (string)$weight ? 'checked="checked"' : '' ?> /> <label for="<?= $this->element->getName()."_".$weight ?>"><?= $this->escape($text) ?></label></li>
	<?php } ?>

	<?php if ($this->element->getAttrib('label_other')): ?>
	<li><input type="radio" value="other" name="<?= $this->element->getName() ?>[value]" id="<?= $this->element->getName()."_other" ?>" <?= $value === 'other' ? 'checked="checked"' : '' ?>/> <label for="<?= $this->element->getName()."_other" ?>"><?= $this->escape($this->element->getAttrib('label_other')) ?></label><input type="text" value="<?= $this->escape($userinput) ?>" name="<?= $this->element->getName() ?>[userinput]" /></li>
	<?php endif; ?>
</ol>
